<template>
  <div class="waper">
    <div class="identification">
      <h1>Wu·后台管理系统框架</h1>
      <div class="slogan">
        <p>{{msg}}</p>
      </div>
    </div>
    <div class="signIn">
      <div class="sigIn_main">
        <h3 class="sigIn_title">欢迎登陆</h3>
        <div class="form">
            <div class="form_item">
                <el-input placeholder="请输入账号" v-model="user.name">
                    <template slot="prepend"><i class="el-icon-user"></i></template>
                </el-input>
            </div>
            <div class="form_item">
                <el-input placeholder="请输入密码" v-model="user.password" show-password>
                    <template slot="prepend"><i class="el-icon-lock"></i></template>
                </el-input>
            </div>
            <div class="form_item">
                <el-button class="sigin_btn" @click="getSignIn">登陆</el-button>
            </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      msg: '世界不会因为所知给你勋章,而会因你的善行而给你荣耀。',
      user:{
        name:'',
        password:''
      }
    }
  },
  methods:{
    getSignIn(){
      if(this.user.name == 'admin'){
        if(this.user.password == 'admin'){
          sessionStorage.setItem('user', JSON.stringify(this.user));
          this.$router.push('/')
          this.$message({
            message: '登录成功',
            type: 'success'
          });
        }else{
          this.$message.error('密码错误');
        }
      }else{
        this.$message.error('登陆账号有误');
      }
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
.waper{
  height: 100%;
  width: 100%;
}
.waper::before{    
    content:'';
    position:absolute;
    height: 100%;
    width: 100%;
    left: 0;
    top: 0;
    background-image:url(../../assets/logo_bg.jpg);
    background-attachment: fixed;
    background-repeat:no-repeat;
    background-size:cover;
    filter:blur(5px);
    z-index:-1;
    background-size:cover;
}
.identification{
  width: 80%;
  height: 100%;
  position: absolute;
  left: 0;
  text-align: left;
    h1{
      padding-top: 20px;
      padding-left: 20px;
      font-size: 40px;
      font-weight: 600;
    }
    .slogan{
      width: 100%;
      position: absolute;
      top: 25%;
      margin: 0 auto;
      text-align: center;
      p{
        font-size: 37px;
        font-weight: 600;
      }
    }
}
.signIn{
  width:380px;
  height: 100%;
  background: #ffffff;
  position: absolute;
  right: 0;
  top: 0;
  .sigIn_main{
    width: 100%;
    position: absolute;
    top:25%;
    text-align: center;
    h3{
      margin-bottom: 30px;
      font-size: 28px;
      padding-bottom: 10px;
      border-bottom: 3px #ccc solid;
      margin-left: auto;
      margin-right: auto;
      width: 30%;
      transition:0.5s;
    }
    h3:hover{
      margin-bottom: 30px;
      font-size: 28px;
      padding-bottom: 10px;
      border-bottom: 3px #ccc solid;
      margin-left: auto;
      margin-right: auto;
      width: 40%;
      transition:0.5s;
    }
    .form{
      padding: 0 30px;
      .form_item{
        margin-bottom: 30px;
        .sigin_btn{
              background: #ccc;
              color: #fff;
              width: 100%;
        }
        .el-button:focus, .el-button:hover{
            background: #a5a5a5;
            border-color: #a0a0a0;
            transition:0.5s;
        }
      }
    }
  }
}
</style>
